<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }

      li {
        list-style: none;
      }

      .box {
        display: flex;
        flex-wrap: wrap;
        margin: 20px auto;
        width: 540px;
      }

      .box li {
        width: 100px;
        height: 100px;
        margin: 0 10px 10px 0;
      }
    </style>
  </head>

  <body>
    <ul class="box">
      <script>
        let num = prompt("请输入渲染英雄图片的数量：");
        let arr = [];
        for (let i = 1; i <= num; i++) {
          arr.push(`./images/${i}.webp`);
        }
        let str = "";
        for (let i = 1; i <= num; i++) {
          str += `<li><img src="arr[i]"></li>`;
        }
        document.write(str);
      </script>
    </ul>
  </body>
</html>
